package com.javashow.main.info.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.javashow.main.info.service.IMainInfoService;

@Controller
@RequestMapping("/info")
public class MainInfoController {
	
	@Autowired
	private IMainInfoService mainInfoService;
	
	/**
	 * 列模式
	 * @param request
	 * @return
	 */
	@RequestMapping("/gridcolumn")
	public @ResponseBody String getMainMenu(HttpServletRequest request) {
		String code = request.getParameter("code");
		
		String result = mainInfoService.getColumnsByCode(code).toString();
		
		return result;//"[{'text':'部门编号','dataIndex':'code','width':100,'id':1},{'text':'部门名称','dataIndex':'name','width':100,'id':2},{'text':'部门经理','dataIndex':'manager','width':100,'id':3},{'text':'职能介绍','dataIndex':'info','width':100,'id':4}]";
	}
	
	/**
	 * 获取grid的store
	 * @param request
	 * @return
	 */
	@RequestMapping("/gridstore")
	public @ResponseBody String getStore(HttpServletRequest request) {
		String code = request.getParameter("code");
		
		String result = mainInfoService.getStoreByCode(code);
		
		return result;
	}
	
	/**
	 * 部门信息
	 * @return
	 */
	@RequestMapping("/deptinfo")
	public @ResponseBody String getDeptInfo() {
		String result = mainInfoService.getDeptInfo().toString();
		return result;
	}
}















